package cn.jiyun.mapper;

import cn.jiyun.pojo.Users;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface UsersMapper {

    @Insert("INSERT INTO `yxy`.`users`(`id`, `name`, `sex`, `pwd`, `birthday`) VALUES (null, #{name}, #{sex}, #{pwd}, #{birthday})")
    void add(Users users);

    @Select("select * from users")
     List<Users> findAll();

    @Select("select * from users where name=#{name} and pwd=#{pwd}")
    Users findByUser(@Param("name") String name, @Param("pwd") String pwd);
}
